package com.llg.controller;

import com.llg.model.response.DataResult;
import com.llg.model.response.PageResult;
import com.llg.model.response.ResponseResult;
import com.llg.pojo.ProcessorSpec;
import com.llg.service.ProcessorSpecService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/processorSpec")
public class ProcessorSpecController {
    @Autowired
    private ProcessorSpecService service;

    //通过品牌id查询全部处理器
    @GetMapping("/findByBid")
    public PageResult<ProcessorSpec> findByBid(Integer bid){
        return service.findByBid(bid);
    }

    //搜索并分页查询
    @PostMapping("/findList")
    public PageResult<ProcessorSpec> findList(Integer currentPage,Integer pageSize,@RequestBody ProcessorSpec processorSpec){
        return service.findList(currentPage, pageSize, processorSpec);
    }

    //通过id查
    @GetMapping("/{id}")
    public DataResult<ProcessorSpec> findById(@PathVariable Integer id){
        return service.findById(id);
    }

    //增
    @PostMapping("/add")
    public DataResult<ProcessorSpec> add(@RequestBody ProcessorSpec processorSpec){
        return service.add(processorSpec);
    }
    //删
    @GetMapping("/delete")
    public ResponseResult delete(Integer id){
        return service.delete(id);
    }

    //改
    @PostMapping("/update")
    public ResponseResult update(@RequestBody ProcessorSpec processorSpec){
        return service.update(processorSpec);
    }

}
